package com.zuul.com.config;

import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import org.apache.log4j.Logger;

import javax.servlet.http.HttpServletRequest;

/**
 * @author HuangSuip
 */
//@Configuration
public class MyZuulFilter2 extends ZuulFilter {
    private static Logger log =  Logger.getLogger(MyZuulFilter2.class);
    @Override
    public String filterType() {
        System.out.println("my zuul filter type pre");
        log.info("filter2 pre filter type");
        return "pre";
    }

    @Override
    public int filterOrder() {
        return 0;
    }

    @Override
    public boolean shouldFilter() {
        System.out.println("should is true");
        return true;
    }

    @Override
    public Object run() {
        RequestContext ctx = RequestContext.getCurrentContext();
        HttpServletRequest request = ctx.getRequest();
        log.info("pre filter run");
        return "my zuul filter user";
    }
}
